#ifndef MUSIC_WINDOW_H
#define MUSIC_WINDOW_H

#include <QWidget>
#include <QString>
#include <QMouseEvent>
#include <QTimer>
#include <QMediaPlayer>
#include <QMediaPlaylist>
#include <QDir>
#include <QTime>
#include "lyricwidget.h"
namespace Ui {
class Music_window;
}

class Music_window : public QWidget
{
    Q_OBJECT

public:
    explicit Music_window(QWidget *parent = nullptr);
    ~Music_window();
    void Music_show(void);
    void paintEvent(QPaintEvent *event);
    bool eventFilter(QObject *obj, QEvent *event);	// 添加时间过滤器声明
    QStringList getFileNames(const QString &path);
    void addItem(char *name);//音乐列表插入数据
    void updateSongLyclist();
private slots:
    void musicInfo();
    void play_list_music(int index);
    void setPlayerPosition(int position);
    void positionChanged(qint64 position);
    void durationChanged(qint64 duration);
    void volumChange(int position);
    void updateSongLrc(qint64 position);
private:
    Ui::Music_window *ui;
      int picture_flag = 0;
      int picture_show_flag = 0;
      QString picture_local=":/picture/music_window/";
      QString picture_name;
    int music_flag = 0;
    int voice_flag = 0;
    QTime *currentTime;
    QTime *totalTime;
    int time;
    int list_flag = 0;
    int shunxi_flag = 0;//0列表循环，1随机循环，2单曲循环
    QString music_name;
    QString music_author;
//

    QString MusicPath="/home/debian/music/";
    QTimer timer;
    QTimer shunxu_timer;
    double angle{0.0};
    QMediaPlayer *player;
    QStringList fileList;
    QMediaPlaylist *playerlist;
    int isPlay=0;
    char music_singl[100][100]={"\0"};//模拟数据库，存放歌曲信息
    int Vposition;
    LyricWidget *Lyric=new LyricWidget(this);//创建歌词窗口指针
};

#endif // MUSIC_WINDOW_H
